/**
 * WTF Engine
 *
 * Released under the terms of the Worcester Public License,
 * see LICENSE in the root folder. This program comes with
 * no warranty whatsoever, implied or otherwise. All rights
 * other than those explicitly specified in the LICENSE document
 * are reserved.
 **
 * Animation Base Classes
 * 
 * Provides base classes allowing animations to be chained together.
 **
 * Author: Sean Micklethwaite
 **/

#ifndef __animationH__
#define __animationH__

#include "dynamic.h"

namespace WtfEngine {
	class Animation : public virtual IDynamic, public GcObject {
		protected:
			Functor::tRef	mrOnComplete;
			bool			mbUseGameTime;
			
		public:
			Animation(bool bUseGameTime = false, const Functor::tRef&	rOnComplete = Functor::tRef())
			: mrOnComplete(rOnComplete), mbUseGameTime(bUseGameTime) {};
			
			virtual void Init() {
				IDynamic::Init();
			};
			
			virtual void Destroy();
			
			virtual void Update(tGameTime dt) = 0;
			
			void Update(){
				Update(mbUseGameTime ? Kernel::GetInstance().GetGameStatePtr()->GetDelta() : Kernel::GetInstance().GetDelta());
			};
			
			void SetOnComplete(const Functor::tRef&	rOnComplete){
				mrOnComplete = rOnComplete;
			};
			
			/// Chains this animation to run when the other animation completes.
			Animation* After(Animation* pAnim);
			
			GC_AUTOSIZE(Animation);
	};
};



#endif
